#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QTimer>
#include <QPainter>
#include <QMouseEvent>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

    void paintEvent(QPaintEvent *event) override;

    // 重写鼠标移动事件
    void mouseMoveEvent(QMouseEvent *event) override;

    // 重写鼠标按压事件
    void mousePressEvent(QMouseEvent *event) override;


private:
    Ui::Widget *ui;
    QPoint m_petPos;
    QSize m_petSize;
    int m_mood;
    QTimer *m_lifeTimer;
    bool m_isHappy;
    int m_petAnimationCounter;
};
#endif // WIDGET_H
